import axios from 'axios'
import {BASE_URL} from '../utils/const'

export function request(config){
  console.log(config);
  const axios1 = axios.create({
      baseURL:BASE_URL,
      method:config.method || 'POST',
      timeout:10000
  })

  // 
  axios1.interceptors.request.use((config)=>{
    if (window.sessionStorage.getItem('token')) {
      config.headers.Authorization = window.sessionStorage.getItem('token')
  }
  return config
  })
  return axios1(config)
}